package codeRandomThoughts.Test674最长连续递增序列;

//贪心写法
public class Solution3 {
    public int findLengthOfLCIS(int[] nums) {
        //dp[i]:以nums[i]为结尾的最长递增子序列的长度
        int[] dp = new int[nums.length];

        dp[0] = 1;

        int maxLen = dp[0];
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] > nums[i - 1]) {
                dp[i] = dp[i - 1] + 1;
            } else {
                dp[i] = 1;
            }

            maxLen = Math.max(maxLen, dp[i]);
        }

        return maxLen;
    }
}
